package com.example.practice.controller;

import com.example.practice.entity.ActivityUrl;
import com.example.practice.service.ActivityUrlService;
import io.swagger.annotations.ApiOperation;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.List;

import javax.annotation.Resource;

/**
 * (ActivityUrl)表控制层
 *
 * @author makejava
 * @since 2024-01-03 09:38:45
 */
@RestController
@RequestMapping("/api/activityUrl")
public class ActivityUrlController {
    /**
     * 服务对象
     */
    @Resource
    private ActivityUrlService activityUrlService;

    @ApiOperation("查询活动图片")
    @GetMapping("/getActivityUrl")
    public List<ActivityUrl> getActivityUrl(Integer aid){
        return this.activityUrlService.getActivityUrl(aid);
    }

    @ApiOperation("插入活动图片")
    @GetMapping("/insertActivityUrl")
    public Integer insertActivityUrl(Integer aid,String url,String fileName){
        return this.activityUrlService.insertActivityUrl(aid,url,fileName);
    }

    @ApiOperation("找到所有有图片的活动")
    @GetMapping("/getAllActUrl")
    public List<ActivityUrl> getAllActUrl(){
        return this.activityUrlService.getAllActUrl();
    }

    @ApiOperation("通过aid找到该活动的所有有图片")
    @GetMapping("/getImageByAid")
    public List<ActivityUrl> getImageByAid(Integer aid){
        return this.activityUrlService.getImageByAid(aid);
    }
}

